package com.ogawa.projectcommon.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;


import com.ogawa.projectcommon.bean.EntityUserDevice;




/**
 * 条件语句中：表示表达式中的值
 */
@Dao
public interface EntityUserDeviceDao {
//    @Query("SELECT * FROM user")
//    List<ProjectUserInfoBean> getAll();
//
////    @Query("SELECT * FROM user WHERE uid IN (:userIds)")
////    List<User> loadAllByIds(int[] userIds);
//
//    @Query("SELECT * FROM user WHERE first_name LIKE :first AND "
//            + "last_name LIKE :last LIMIT 1")
//    User findByName(String first, String last);
//
//    @Query("SELECT * FROM user WHERE first_name LIKE :first LIMIT 1")
//    User findByFirstNameByFirst(String first);
//
////    @Query("SELECT * from user ORDER BY first_name ASC")
////    List<User> findByFirstName(String first);
//
//    //改
//    @Update
//    void update(User... users);
//
//
//    @Insert
//    void insertAll(User... users);
//
//    @Delete
//    void delete(User user);
//
//    @Query("DELETE FROM user")
//    void deleteAll();

    @Query("SELECT * FROM " + "EntityUserDevice" + " WHERE user_id LIKE :user_id")
    EntityUserDevice[] loadAllEntityUserDeviceByName(String user_id);

    @Query("SELECT * FROM " + "EntityUserDevice" + " WHERE deviceSN LIKE  :sn LIMIT 1")
    EntityUserDevice loadAllEntityUserDeviceBySN(String sn);

    @Query("SELECT * FROM " + "EntityUserDevice" + " WHERE deviceId LIKE  :deviceId LIMIT 1")
    EntityUserDevice loadAllEntityUserDeviceByDeviceID(String deviceId);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertUserDevice(EntityUserDevice... users);

    @Delete
    void deleteEntityUserDevice(EntityUserDevice device);

    @Update
    void updateEntityUserDevice(EntityUserDevice device);


}
